home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Answers 2002 January
/
PC Answers January 2002.7z
/
PC Answers January 2002.bin
/
graphics
/
freepixl
/
_SETUP.1
/
images2.pxl
< prev
next >
Wrap
Text File
|
2000-10-10
|
29KB
|
1,098 lines
Initialize:
UseCoordinates(PIXEL)
SetColorPalette(BITMAP)
Title$ = "PiXCL 5.0 Image Processing"
UseCaption(Title$)
UseBackground(TRANSPARENT,166,166,166)
DrawBackground
WinAdjustRect(50,100,880,635,MENU,wx1,wy1,wx2,wy2)
WinLocate(Title$,wx1,wy1,wx2,wy2,Res) {100,100,880,635}
WinShow(Title$,TOPMOST,Res)
{AboutPiXCL}
ImageFile$ = ""
DirGet(SourceDir$)
Image1$ = SourceDir$ + "\brsfbnd1.bmp"
Image2$ = SourceDir$ + "\brsfbnd2.bmp"
Image3$ = SourceDir$ + "\brsfbnd3.bmp"
Image4$ = SourceDir$ + "\brsfbnd4.bmp"
Image5$ = SourceDir$ + "\brsfbnd5.bmp"
Image7$ = SourceDir$ + "\brsfbnd7.bmp"
Image8$ = SourceDir$ + "\brsfc754.bmp"
Image9$ = SourceDir$ + "\brstclas.bmp"
Image10$ = SourceDir$ + "\brstgrid.bmp"
Image11$ = SourceDir$ + "\brstrans.bmp"
Image12$ = SourceDir$ + "\brstran1.bmp"
UseFont("MS Sans Serif",0,19,NOBOLD,NOITALIC,NOUNDERLINE,255,0,0)
InitFile$ = "*.bmp"
InfoMenu(REMOVE)
WaitInput(100)
SetMenu("&File",IGNORE,
"&Raw Options",RawOptionsDlg,
"&Show Cmd Line",ShowCmdLine,
"E&xit!",Leave,
ENDPOPUP,
"&Image Info",IGNORE,
"&DropLoadImage",DropLoadImage,
"&Load Image",GetImageInfo,
"&Save Image",SaveImageInfo,
SEPARATOR,
"&Preview ImageBox",ShowPreviews,
SEPARATOR,
"&Histogram Test",MakeHistogram,
"&Update Histogram", Update_Histogram,
"&Remove Histogram",Remove_Histogram,
SEPARATOR,
"&Zooming",Zooming,
"&Roaming",Roaming,
SEPARATOR,
"Counting Colors",CountingTheColors,
SEPARATOR,
"List Bitmaps",CountTheList,
SEPARATOR,
"Help",HelpGetImageInfo,
ENDPOPUP,
"Compose BitMap",IGNORE,
"Show Channel Histograms",GetRGBchannels,
"Show Components",Components,
"Replace Channel",Replacer,
"Combine Channels",Combiner,
ENDPOPUP,
"Point Ops",IGNORE,
"Clear Window",Clear,
SEPARATOR,
"Clear All",ClearAll,
SEPARATOR,
"Theme Overlays",OverlayThemes,
"Grid Overlays",OverlayGrids,
SEPARATOR,
"F/G Mode", SettingDrawMode,
"ReDraw Bkg", ReDrawingBkg,
"Draw Tr image",DrawTransparency,
"Transparency", Transparency,
SEPARATOR,
"Fast Classify",Fast_Classify,
"Remap Colors",ImageRemapper,
SEPARATOR,
"Scatter",DisplacePixels,
"Despeckle",Despecker,
"Tune Up",BrightnessContrastUp,
"Tune Down",BrightnessContrastDn,
"Equalize",Equalizer,
"Normalize",Normalizer,
"Normalize Range",NormalizerRange,
"Flip Image",FlipVertical,
"Mirror Image",FlipHorizontal,
"Negative",Inversion,
"Average",Averaging,
"Blur",Blurring,
"Gaussian Blur",GBlurring,
"Sharpen",Sharpening,
"Add Noise",Noisy,
SEPARATOR,
"Help",HelpPaint,
ENDPOPUP,
"F&ilters",IGNORE,
"&View Filter",View_Filter,
"&Create/Edit 5x5 Filter",MakeFilterMatrix,
"Filter 5x5",Do5xFilter,
"Filter 15x15",Do15xFilter,
ENDPOPUP,
"Matrix Ops",IGNORE,
"Emboss",Embossing,
"EdgeDetect",EdgeDetect,
ENDPOPUP,
"Geometric Ops",IGNORE,
"Skew V",SkewerV,
"Skew H",SkewerH,
"Rotate",ImageRotation,
"RotateExt",ImageRotationExt,
SEPARATOR,
"Crop Image",Cropper,
"Resize", Resizer,
"Resample",Resampler,
ENDPOPUP,
"Color Space",IGNORE,
"RGB32 32-bit",Cspace1,
SEPARATOR,
"RGB24 24-bit",Cspace2,
"CIELAB 24-bit",Cspace9,
SEPARATOR,
"RGB555 16-bit",Cspace3,
"RGB565 16-bit",Cspace3a,
"GRAY16 16-bit",Cspace10,
SEPARATOR,
"INDEXED 8-bit",Cspace4,
"GRAYSCALE 8-bit",Cspace5,
SEPARATOR,
"MONO 1-bit",Cspace11,
ENDPOPUP,
"&About",AboutThisApp,
ENDPOPUP)
StatusWindow(ENABLE,BOTTOM,4,290,390,490,-1)
GoSub Create_PiXCL_Toolwindow
Filter$ = "BMP files(*.bmp),*.bmp,JPG files(*.jpg),*.jpg,"
Filter$ = Filter$ + "PCD files(*.pcd),*.pcd,"
Filter$ = Filter$ + "PNG files(*.png),*.png,PCX files(*.pcx),*.pcx,"
Filter$ = Filter$ + "PSD files(*.psd),*.psd,RAS files(*.ras),*.ras,"
Filter$ = Filter$ + "TGA files(*.tga),*.tga,TIF files(*.tif),*.tif"
UseBackground(TRANSPARENT,166,166,166)
DragAcceptFile(ENABLE,DragLoadImage)
GetCmdLine(Cmd$)
DrawBackground
GoSub GetCmdArg
If ImageFile$ <> "" Then Goto ProcessImage
Wait_for_Input:
WaitInput()
Leave:
Histogram()
FreeBitmapAll
End
AboutThisApp:
AboutUser("Sample Program","","")
Goto Wait_for_Input
RawOptionsDlg:
DrawBackground
HelpInfo$ =
"Issues related to importing raw image data
into a PiXCL application are:
band interleaved or band sequential;
if 16 bit, are the high bytes first or last;
i.e. bigendian or little endian;
should the bitmap be inverted on load.
The bitmap is loaded into the PiXCL image list
and can be displayed, processed and saved in the
usual way. The sample image about to be loaded
is 3-channel RGB, 128-byte header size."
RawImage$ = SourceDir$ + "\brsfc754.raw" {500x406}
RawImage$ = "D:\E18mp0911.i"
UseFont("Arial",7,15,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
Xsize = 768 Ysize = 11000 Header = 512
RawDataParamBox(RawImage$,HelpInfo$,Xsize,Ysize,Samples,Bits, Header,Flags)
DrawText(10,40,"Xsize = ") DrawNumber(80,40,Xsize)
DrawText(120,40,"Ysize = ") DrawNumber(190,40,Ysize)
DrawText(10,65,"Channels = ") DrawNumber(120,65,Samples)
DrawText(10,90,"Bits/Sample = ") DrawNumber(120,90,Bits)
DrawText(10,115,"Offset = ") DrawNumber(120,115,Header)
DrawText(10,140,"Flags = ") DrawNumber(120,140,Flags)
If Flags <> 0
UseCursor(WAIT)
ReadRawBitmap(RawImage$,Xsize,Ysize,Samples,Bits, Header,Flags)
ImageFile$ = RawImage$
If Flags <> 0 Then DrawBitmap(30,38,ImageFile$)
UseCursor(ARROW)
Endif
Goto Wait_for_Input
View_Filter:
MTX_Filter$ = "All Filters (*.mtx),*.mtx"
Label$ = "Select a filter to view"
InitFile$ = "*.mtx"
FileGet(MTX_Filter$,InitFile$,SourceDir$,Label$,CHANGEDIR,Filter5x$)
If Filter5x$ <> ""
ViewFilterFile(Filter5x$)
Endif
Goto Wait_for_Input
MakeFilterMatrix:
MTX_Filter$ = "All Filters (*.mtx),*.mtx"
Label$ = "Select a filter to create or edit"
InitFilterFile$ = "*.mtx"
FileGet(MTX_Filter$,InitFilterFile$,SourceDir$,Label$,CHANGEDIR,Filter5x$)
If Filter5x$ <> ""
Create5x5Filter(Filter5x$,Res)
Endif
Goto Wait_for_Input
Do5xFilter:
WaitInput(1)
If ImageFile$ <> ""
If Filter5x$ = "" Then Filter5x$ = SourceDir$ + "\test5x.mtx"
UseCursor(WAIT)
FilterImage5x(Filter5x$,Res)
UseCursor(ARROW)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Endif
Filter5x$ = ""
Goto Wait_for_Input
Do15xFilter:
WaitInput(1)
If ImageFile$ <> ""
Filter15x$ = SourceDir$ + "\average.mtx"
UseCursor(WAIT)
FilterImage15x(Filter15x$,Res)
UseCursor(ARROW)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
ShowCmdLine:
GetCmdLine(Cmd$)
MessageBox(OK,1,INFORMATION,Cmd$,"Command Line",Res)
Goto Wait_for_Input
GetCmdArg:
InStr(Cmd$," ",Loc)
If Loc = 0
ImageFile$ = ""
Else
RightOf(Cmd$,Loc,ImageFile$)
StrRev(ImageFile$)
Trim(ImageFile$)
StrRev(ImageFile$)
InStr(ImageFile$,"pxl",Loc)
If Loc <> 0 Then ImageFile$ = ""
Endif
FreeVar(Cmd$)
Return
ShowPreviews:
If ImageFile$ <> "" Then ImageBox("Image #1",ImageFile$,"image #1","OK","Cancel",Btn)
Goto Wait_for_Input
CountingTheColors:
CountBitmapColors(ImageFile$,Colors)
If Colors <> 0
Str(Colors,Colors$)
Msg$ = "Number of unique colors in this image = " + Colors$
MessageBox(OK,1,INFORMATION,Msg$,ImageFile$,Res)
Endif
Goto Wait_for_Input
CountTheList:
Chr(13,CR$)
ListLoadedBitmaps(List$,CR$,Count)
If List$ = "" Then List$ = "No images loaded."
Str(Count,Count$)
Msg$ = "Entries in PiXCL Bitmap List = " + Count$
MessageBox(OK,1,INFORMATION,List$,Msg$,Res)
Goto Wait_for_Input
OverlayThemes:
If ImageFile$ = "" Then Beep Goto Wait_for_Input
WaitInput(1)
LoadBitmap(Image9$,FULL)
DrawBitmap(30,38,ImageFile$)
OverlayImage(Image9$, 0,0,0, Res)
If Res = 0
MessageBox(OK,1,INFORMATION,"Overlay failed","DEBUG",Res)
Endif
GetBitMapDim(ImageFile$,Lines,Pixels,Bits)
DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
OverlayGrids:
If ImageFile$ = "" Then Beep Goto Wait_for_Input
WaitInput(1)
LoadBitmap(Image10$,FULL)
DrawBitmap(30,38,ImageFile$)
OverlayImage(Image10$, 255,255,255, Res)
If Res = 0
MessageBox(OK,1,INFORMATION,"Overlay failed","DEBUG",Res)
Endif
GetBitMapDim(ImageFile$,Lines,Pixels,Bits)
DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
SettingDrawMode:
MessageBox(YESNOCANCEL,1,QUESTION,
"Yes = FOREGND, No = BCKGND, Cancel = BOTH",
"Setting Draw Mode",Res)
If Res = 1 Then SetDrawMode(FOREGND)
If Res = 2 Then SetDrawMode(BACKGND)
If Res = 3 Then SetDrawMode(BOTH)
Goto Wait_for_Input
ReDrawingBkg:
ReDraw
Goto Wait_for_Input
DrawTransparency:
DrawBitmap(30,38,Image9$)
Goto Wait_for_Input
Transparency:
WaitInput(1)
GetBitmapDim(Image12$,Lines,Pixels,Bits)
nx = 30 ny = 30
DrawBitmap(30,38,Image9$)
SetDrawMode(FOREGND)
For xx = 0 To 40
{draw the foreground graphics}
DrawTrBitmap(nx,ny,Image12$,0,0,0)
nx2 = nx + Pixels
ny2 = ny + Pixels
nx += 5 ny++
{update the background buffer}
SetDrawMode(BACKGND)
DrawTrBitmap(nx,ny,Image12$,0,0,0)
WaitInput(1)
DrawBackgroundRegion(nx,ny,nx2,ny2)
DrawBitmap(30,38,Image9$)
SetDrawMode(FOREGND)
Next
Goto Wait_for_Input
Roaming:
If ImageFile$ <> ""
ZoomFactor = 4
X2 = 30 + Pixels
Y2 = 30 + Lines
X3 = X2 + 20
X4 = X3 + 60
Pix = Pixels/2
Piy = Lines/2
DrawZoomedBitmap(30,38,X2,Y2,ImageFile$,Pix,Piy,ZoomFactor)
SetCtrlMouse(30,38,X2,Y2,PosRoam,Px,Py)
SetShftRightMouse(30,38,X2,Y2,NegRoam,Px,Py)
Endif
Goto Wait_for_Input
PosRoam:
If ImageFile$ <> ""
Pix = Px - 30
DrawZoomedBitmap(30,38,X2,Y2,ImageFile$,Pix,Piy,ZoomFactor)
Endif
Goto Wait_for_Input
NegRoam:
If ImageFile$ <> ""
ZoomFactor = 4
Pix = 100
While Pix < 350
DrawZoomedBitmap(30,38,X2,Y2,ImageFile$,Pix,Piy,ZoomFactor)
Pix += 2
EndWhile
SetShftRightMouse()
Endif
Goto Wait_for_Input
Zooming:
ZoomFactor = 1
X2 = 30 + Pixels
Y2 = 30 + Lines
X3 = 537
X4 = X3 + 60
Pix = Pixels/2
Piy = Lines/2
DrawZoomedBitmap(30,38,X2,Y2,ImageFile$,Pix,Piy,ZoomFactor)
SetMouse(30,38,X2,Y2,PosZoom,Px,Py)
SetRightMouse(30,38,X2,Y2,NegZoom,Px,Py)
UseBackground(OPAQUE,192,192,192)
UsePen(SOLID,1,0,0,0)
UseBrush(SOLID,0,0,0)
WaitInput()
PosZoom:
If ImageFile$ <> ""
ZoomFactor++
If ZoomFactor > 16 Then ZoomFactor = 16
DrawText(X3,410,"Zoom ")
DrawNumber(X4,410,ZoomFactor)
Px -= 30 Py = Lines - Py Py += 30
DrawZoomedBitmap(30,38,X2,Y2,ImageFile$,Px,Py,ZoomFactor)
Endif
Goto Wait_for_Input
NegZoom:
If ImageFile$ <> ""
ZoomFactor--
If ZoomFactor < 1 Then ZoomFactor = 1
DrawText(X3,410,"Zoom ")
DrawNumber(X4,410,ZoomFactor)
Px -= 30 Py = Lines - Py Py += 30
DrawZoomedBitmap(30,38,X2,Y2,ImageFile$,Px,Py,ZoomFactor)
Endif
Goto Wait_for_Input
DropLoadImage:
DFServer = 1
Goto GetImageInfo
DragLoadImage:
GetDragList(ImageFile$)
Goto ProcessImage
GetImageInfo:
DrawBackGround
SetMouse()
SetRightMouse()
Histogram()
WaitInput(1)
If ImageFile$ <> "" Then FreeBitMap(ImageFile$)
FileGet(Filter$, InitFile$, "",
"Select an image to load",CHANGEDIR,ImageFile$)
If ImageFile$ = "" Then Goto Wait_for_Input
ProcessImage:
If DFServer <> 1
FileExtension(ImageFile$,Ext$,Res)
InitFile$ = "*." + Ext$
Ext$ = Ext$ + " Image File Format Read"
GetBitMapDim(ImageFile$,Lines,Pixels,Bits)
DrawBackGround
DrawText(25,0,Ext$)
DrawText(560,30,"Lines") DrawNumber(660,30,Lines)
DrawText(560,50,"Pixels") DrawNumber(660,50,Pixels)
DrawText(560,70,"Bits") DrawNumber(660,70,Bits)
If Bits <> 0
sx1 = 27 sy1 =35
sx2 = 33 + Pixels sy2 = 41 + Lines
DrawEdgeRectangle(sx1,sy1,sx2,sy2,SUNKENEDGE,ADJUST,RECT)
DrawBitmap(30,38,ImageFile$)
SetCurrentBitmap(ImageFile$, FULL,BitmapHandle)
Histogram(600,40,POPUP,ImageFile$, BitmapHandle ,NONCUM,"",HistID)
Endif
Else
DropFileServer(ENABLE,ImageFile$)
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,EndDFS,n,n)
Endif
Goto Wait_for_Input
EndDFS:
SetMouse()
UseCaption(Title$)
DFServer = 0
Goto Wait_for_Input
SaveImageInfo:
FileSaveAs(Filter$, InitFile$, "",
"Select save image Filename",CHANGEDIR,ImageFile$)
If ImageFile$ = "" Then Goto Wait_for_Input
SaveBitmap(ImageFile$,Res)
Goto Wait_for_Input
UndoLastOperation:
WaitInput(1)
If ImageFile$ <> ""
FreeBitmap(ImageFile$)
sx1 = 27 sy1 =35
sx2 = 33 + Pixels sy2 = 41 + Lines
DrawEdgeRectangle(sx1,sy1,sx2,sy2,SUNKENEDGE,ADJUST,RECT)
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
GetRGBchannels: {shows the HANDLE of each channel in an image.}
GetChannel(RED,RedHandle)
GetChannel(GREEN,GreenHandle)
GetChannel(BLUE,BlueHandle)
{now create the histograms}
Histogram(530,100,POPUP, RedHandle,NONCUM,"Red",Histogram1,
530,260,POPUP, GreenHandle,NONCUM,"Green",Histogram2,
530,420,POPUP, BlueHandle,NONCUM,"Blue", Histogram3)
Goto Wait_for_Input
Components: {draw all the test images}
DrawBackGround
DrawSizedBitMap(30,38,100,100,Image1$) SetCurrentBitmap(Image1$, FULL,Band1Handle)
DrawSizedBitMap(30,38,100,100,Image2$) SetCurrentBitmap(Image2$, FULL,Band2Handle)
DrawSizedBitMap(30,38,100,100,Image3$) SetCurrentBitmap(Image3$, FULL,Band3Handle)
DrawSizedBitMap(30,38,100,100,Image4$) SetCurrentBitmap(Image4$, FULL,Band4Handle)
DrawSizedBitMap(30,38,100,100,Image5$) SetCurrentBitmap(Image5$, FULL,Band5Handle)
DrawSizedBitMap(30,38,100,100,Image7$) SetCurrentBitmap(Image7$, FULL,Band7Handle)
GetBitMapDim(Image8$,Lines,Pixels,Bits)
If Bits <> 0
sx1 = 27 sy1 = 35
sx2 = 33 + Pixels sy2 = 41 + Lines
DrawEdgeRectangle(sx1,sy1,sx2,sy2,SUNKENEDGE,ADJUST,RECT)
DrawBitmap(30,38,Image8$)
Endif
DrawBitmap(30,38,Image8$) SetCurrentBitmap(Image8$, FULL,Band8Handle)
GetChannel(RED,RedHandle)
GetChannel(GREEN,GreenHandle)
GetChannel(BLUE,BlueHandle)
ImageFile$ = Image8$
Goto Wait_for_Input
Replacer:
SetEditControl()
WaitInput(1)
ImageFile$ = Image8$
DrawBitmap(30,38,ImageFile$)
TuneImage(0,0,0,0,0,0,Band8Handle)
Channel$ = "0" Band$ = "1"
SetEditControl(550,50,600,75,NUMBERUD,2,0,Channel$,
550,85,600,110,NUMBERUD,7,1,Band$)
DrawText(630,50,"Image Channel")
DrawText(630,85,"Replace with")
Button(550,130,620,150,PUSH,"&Replace",Replacer_R,
550,160,620,180,PUSH,"&Done",Replacer_D,
530,10,750,200,GROUP,"Replace Channel",Replacer_R,
550,260,700,285,AUTORADIO,"Red Channel",Replacer_R,
550,300,700,325,AUTORADIO,"Green Channel",Replacer_R,
550,340,700,365,AUTORADIO,"Blue Channel",Replacer_R,
530,230,750,400,GROUP,"Classify",Replacer_R)
DrawStatusWinText(0,ImageFile$)
GetBitmapDim(ImageFile$,Lines, Pixels,Bits)
Str(Lines,Lines$) Lines$ = "Lines=" + Lines$
Str(Pixels,Pixels$) Pixels$ = "Pixels=" + Pixels$
Str(Bits,Bits$) Bits$ = "Bits/Pixel=" + Bits$
DrawStatusWinText(1,Lines$)
DrawStatusWinText(2,Pixels$)
DrawStatusWinText(3,Bits$)
WaitInput()
Replacer_R:
Val(Channel$,Channel,Res)
Val(Band$,Band,Res)
If Band = 1 Then NewHandle = Band1Handle
If Band = 2 Then NewHandle = Band2Handle
If Band = 3 Then NewHandle = Band3Handle
If Band = 4 Then NewHandle = Band4Handle
If Band = 5 Then NewHandle = Band5Handle
If Band = 7 Then NewHandle = Band7Handle
ReplaceChannel(Band8Handle,NewHandle,Channel,Res)
If Res = 0 Then MessageBox(OK,1,INFORMATION,"Replace Channel failed","",Res)
DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
Replacer_D:
SetEditControl()
Button()
UsePen(NULL,1,0,0,0)
UseBrush(SOLID,192,192,192)
Drawrectangle( 530,10,750,200)
Goto Wait_for_Input
Combiner:
TuneImage(0,0,0,0,0,0,Band8Handle)
CombineChannels(Band7Handle,Band3Handle,Band1Handle,Band8Handle,Res)
If Res = 0 Then MessageBox(OK,1,INFORMATION,"Combine Channel failed.","",Rss)
If Res <> 0 Then DrawNumber(200,0,Res)
DrawBitmap(30,38,Image8$)
SaveBitmap("test.bmp", Res)
GetBitMapDim("test.bmp",Lines,Pixels,Bits)
DrawText(25,0,Ext$)
DrawText(560,30,"Lines") DrawNumber(660,30,Lines)
DrawText(560,50,"Pixels") DrawNumber(660,50,Pixels)
DrawText(560,70,"Bits") DrawNumber(660,70,Bits)
GetChannel(RED,RedHandle)
GetChannel(GREEN,GreenHandle)
GetChannel(BLUE,BlueHandle)
Goto Wait_for_Input
Noisy:
AddNoiseToImage(50,DISTRIBUTED,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
Cropper:
CropImage(20,20,180,220,Res)
If Res <> 0
DrawBackGround
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Resampler:
ResampleImage(300,300,NEAREST,Res)
If Res <> 0
DrawBackGround
DrawBitMap(50,50,ImageFile$)
Endif
WaitInput(2000)
FreeBitMap(ImageFile$)
DrawBitMap(50,50,ImageFile$)
ResampleImage(300,300,BILINEAR,Res)
If Res <> 0
DrawBackGround
DrawBitMap(50,50,ImageFile$)
Endif
WaitInput(2000)
FreeBitMap(ImageFile$)
DrawBitMap(50,50,ImageFile$)
ResampleImage(300,300,BICUBIC,Res)
If Res <> 0
DrawBackGround
DrawBitMap(50,50,ImageFile$)
Endif
Goto Wait_for_Input
Resizer:
ResizeImage(200,200,Res)
If Res <> 0
DrawBackGround
DrawBitMap(50,50,ImageFile$)
Endif
Goto Wait_for_Input
Cspace1:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(RGB32,NONE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace2:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(RGB24,NONE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace3:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(RGB555,DIFFUSE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace3a:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(RGB565,DIFFUSE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace4:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(INDEXED,DIFFUSE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace5:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(GRAYSCALE,DIFFUSE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace6:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(RGB48,DIFFUSE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace7:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(CMYK,DIFFUSE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace8:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(YCBCR,DIFFUSE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace9:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(CIELAB,DIFFUSE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace10:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(GRAY16,NONE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace failed.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
Cspace11:
DrawBitmap(30,38,ImageFile$)
UseCursor(WAIT)
ConvertColorSpace(MONO,NONE,Res)
UseCursor(ARROW)
If Res = 0
MessageBox(OK,1,INFORMATION,"ConvertColorSpace returned 0.","",Res)
Else
DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
MakeHistogram: {testing ... creates and deletes data buffes only}
If ImageFile$ = "" Then Goto Wait_for_Input
WaitInput(1)
ShowHistogram(ImageFile$,Res)
If Res = 0
MessageBox(OK,1,INFORMATION,"ShowHistogram returned 0.","PiXCL Test App",Res)
Endif
DrawBitmap(30,38,ImageFile$ )
TuneImage(0,0,0,0,0,0,BitmapHandle)
Histogram(820,100,POPUP,ImageFile$,BitmapHandle,NONCUM,"Gray", HistNumber1,
820,300,POPUP,ImageFile$,BitmapHandle,CUM,"Gray",HistNumber2)
Goto Wait_for_Input
Update_Histogram:
GetChannel(RED,RedHandle)
GetChannel(GREEN,GreenHandle)
GetChannel(BLUE,BlueHandle)
UpdateHistogram(RedHandle,Histogram1,RECALC_CUM,Res)
UpdateHistogram(GreenHandle,Histogram2,RECALC_CUM,Res)
UpdateHistogram(BlueHandle,Histogram3,RECALC_CUM,Res)
UpdateHistogram(RedHandle,HistNumber1,RECALC_CUM,Res)
UpdateHistogram(HistNumber2,RECALC_NONCUM,Res)
Goto Wait_for_Input
Remove_Histogram:
Histogram()
HistNumber1 = 0
HistNumber2 = 0
Goto Wait_for_Input
DisplacePixels:
ScatterPixels(20,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
Fast_Classify:
WaitInput(1)
If ImageFile$ <> ""
PaletteFile$ = SourceDir$ + "\vtheme.pal"
RemapImage(PaletteFile$,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
ImageRemapper:
WaitInput(1)
If ImageFile$ <> ""
PaletteFile$ = SourceDir$ + "\negmap.pal"
RemapImage(PaletteFile$,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Endif
Goto Wait_for_Input
ImageRotation:
WaitInput(1)
RotateImage(11,Res)
xx2 = sx2 - 2
yy2 = sy2 - 2
{If Res <> 0 Then DrawSizedBitMap(30,38,xx2,yy2,ImageFile$)}
If Res <> 0 Then DrawBitMap(30,38,ImageFile$)
Goto Wait_for_Input
ImageRotationExt:
WaitInput(1)
xx2 = sx2 - 2
yy2 = sy2 - 2
SetMouse(30,38,xx2,yy2,GetRotationPoint,rx,ry)
UseCursor(CROSSHAIR)
WaitInput()
GetRotationPoint:
SetMouse()
UseCursor(WAIT)
{ Correct client coords to image coords, and invert the Y coord because of the
way bitmaps are stored.
}
rrx = rx -30
rry = ry - 38 rry = 406 - rry
RotateImageExt(rrx,rry,11,BICUBIC,Res)
UseCursor(ARROW)
If Res <> 0
{DrawSizedBitMap(30,38,xx2,yy2,ImageFile$)}
DrawBitMap(30,38,ImageFile$)
UsePen(SOLID,1,255,0,0)
UseBrush(NULL,0,0,0)
DrawPoint(rx,ry,CIRCLE)
Else
MessageBox(OK,1,EXCLAMATION, "RotateImageEx Failed","",Res)
Endif
Goto Wait_for_Input
SkewerV:
SkewImage(17,VERT,Res)
xx2 = sx2 - 2
yy2 = sy2 - 2
If Res <> 0 Then DrawSizedBitMap(30,38,xx2,yy2,ImageFile$)
Goto Wait_for_Input
SkewerH:
SkewImage(17,HORZ,Res)
xx2 = sx2 - 2
yy2 = sy2 - 2
If Res <> 0 Then DrawSizedBitMap(30,38,xx2,yy2,ImageFile$)
Goto Wait_for_Input
BrightnessContrastUp:
Count = 0
While Count < 10
TuneImage(10,10,10,5,5,5,Res)
Count++
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
EndWhile
Goto Wait_for_Input
BrightnessContrastDn:
Count = 0
While Count < 10
TuneImage(-10,-10,-10,-5,-5,-5,Res)
Count++
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
EndWhile
Goto Wait_for_Input
Equalizer:
WaitInput(1)
EqualizeImage(Res)
GetListBitmapDim(ImageFile$,L,P,Bits)
GetChannel(RED,BitmapChannel)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$) UpdateHistogram(BitmapChannel,HistID,RECALC_NONCUM,Res)
Goto Wait_for_Input
Normalizer:
WaitInput(1)
NormalizeImage(Res)
GetListBitmapDim(ImageFile$,L,P,Bits)
GetChannel(RED,BitmapChannel)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$) UpdateHistogram(BitmapChannel,HistID,RECALC_NONCUM,Res)
Goto Wait_for_Input
NormalizerRange:
WaitInput(1)
NormalizeImageRange(20,220,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
Despecker:
WaitInput(1)
DespeckleImage(50,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
FlipVertical:
WaitInput(1)
FlipImage(VERT,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
FlipHorizontal:
WaitInput(1)
FlipImage(HORZ,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
Inversion:
WaitInput(1)
InvertImage(Res)
GetListBitmapDim(ImageFile$,L,P,Bits)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
GetChannel(RED,BitmapChannel)
UpdateHistogram(BitmapChannel,HistID,RECALC_NONCUM,Res)
Goto Wait_for_Input
Embossing:
EmbossImage(4,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
EdgeDetect:
EdgeDetectImage(Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
Averaging:
AverageImage(60,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
Blurring:
BlurImage(90,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
GBlurring:
UseCursor(WAIT)
GaussianBlurImage(90,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
TuneImage(0,0,0,0,0,0,BitmapHandle)
Histogram(600,40,POPUP,ImageFile$, BitmapHandle ,NONCUM,"90% blur",HistID)
UseCursor(ARROW)
Goto Wait_for_Input
Sharpening:
SharpenImage(10,Res)
If Res <> 0 Then DrawBitmap(30,38,ImageFile$)
Goto Wait_for_Input
HelpGetImageInfo:
MessageBox(OK,1,INFORMATION,
"Select an image file and get the parameters:
pixels per line, lines, bits per pixel. Image
can be optionally displayed.",
"Get supported bitmap image parameters.",Res)
Goto Wait_for_Input
HelpPaint:
MessageBox(OK,1,INFORMATION,
"Paint the test BMP, JPG, PCX, PNG, RAS,
TGA and TIF images cascaded across the client area.",
"Painting an image.",Res)
Goto Wait_for_Input
Clear:
DrawBackGround
Goto Wait_for_Input
ClearAll:
DrawBackGround
StatusWindow(ENABLE,BOTTOM,4,290,390,490,-1)
FreeBitMapAll
ImageFile$ = "" { could also use FreeVar(imageFile$) }
Goto Wait_for_Input
Test:
Goto Wait_for_Input
Create_PiXCL_Toolwindow:
Toolbar(RAISED,
PXL_SMALL,
NULL, NULL, SEPARATOR, "", Test,
NEW, ENABLED, STD, "FileNew", Test,
OPEN, ENABLED, STD, "FileOpen", GetImageInfo,
SAVE, ENABLED, STD, "FileSave", SaveImageInfo,
NULL, NULL, SEPARATOR, "", Test,
NULL, NULL, SEPARATOR, "", Test,
CUT, ENABLED, CHECK_G, "Edit: Cut", Test,
COPY , ENABLED, CHECK_G, "Edit: Copy", Test,
PASTE, ENABLED, CHECK_G, "Edit: Paste", Test,
DELETE, ENABLED, CHECK_G, "Edit: Delete", Test,
REPLACE, ENABLED,CHECK_G,"Edit: Replace",Test,
REDO, ENABLED, STD, "Redo", Test,
UNDO, ENABLED, STD, "Undo", UndoLastOperation,
PRINT, ENABLED, STD, "Print", Test,
NULL, NULL, SEPARATOR, "", Test,
FIND, ENABLED, STD, "Find", Test,
PROP, ENABLED, STD,"Properties", Test,
PPREV, ENABLED, STD, "Print Preview", Test,
HELPINFO, ENABLED, STD, "Show Help", Test)
ToolWindow( 510,150,613,424,POPUP,"PiXCL 4.4",
RAISED, PXL_LARGE,
ANNOT, ENABLED, STD, "Annotation", Test,
SQSELECT, ENABLED, STD, "Select", Test,
POLYSELECT, ENABLED, STD, "PolySelect", Test,
ERASE, ENABLED, STD, "Clear All Images", ClearAll,
OPENIMAGE, ENABLED, STD, "Get Bitmap Info", GetImageInfo,
HISTOGRAM, ENABLED, STD, "Histogram",MakeHistogram,
MIRROR, ENABLED, STD, "Image Mirror",FlipHorizontal,
FLIP, ENABLED, STD, "Image Flip", FlipVertical,
ROTATE, ENABLED, STD, "Image Rotate", ImageRotation,
SHOWRGB, ENABLED, STD, "Tune Down", BrightnessContrastDn,
PICKRGB, ENABLED, STD, "Pick RGB", Test,
CLASSIFY, ENABLED, STD, "Overlays", OverlayThemes,
NORMALIZE, ENABLED, STD, "Normalize Image", Normalizer,
EQUALIZE, ENABLED, STD, "Equalize Image", Equalizer,
NEGATIVE, ENABLED, STD, "Negative Image", Inversion,
GAMMACRCT, ENABLED, STD, "Gamma Correct", Test,
IMAGEINFO, ENABLED, STD, "ImageInfo", CountTheList,
FINGER, ENABLED, STD, "Finger", Test,
HAND, ENABLED, STD, "Hand", Test,
FLOOD, ENABLED, STD, "Flood", Test,
SPRAY, ENABLED, STD, "Spray", Test,
ZOOMUP, ENABLED, STD, "Positive Zoom", PosZoom,
ZOOMDN, ENABLED, STD, "Negative Zoom", NegZoom,
BRUSH, ENABLED, STD, "Brush", Test)
WinSetActive(Title$,Res)
Return